package com.dongdongshop.service.impl;

import com.dongdongshop.mapper.TbPersonMapper;
import com.dongdongshop.mapper.TbUserMapper;
import com.dongdongshop.pojo.TbPerson;
import com.dongdongshop.pojo.TbPersonExample;
import com.dongdongshop.pojo.TbUser;
import com.dongdongshop.pojo.TbUserExample;
import com.dongdongshop.service.TbPersonService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@DubboService
class TbPersonServiceImpl implements TbPersonService {
    @Autowired
    private TbPersonMapper personMapper;

    @Override
    public TbPerson getUserByName(String username) {
        TbPersonExample example = new TbPersonExample();
        TbPersonExample.Criteria criteria = example.createCriteria();
        criteria.andPnameEqualTo(username);
        List<TbPerson> list = personMapper.selectByExample(example);
        return (list ==null || list.isEmpty())?null:list.get(0);
    }
}
